package com.maimao.model.kill;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
@Builder
@TableName("tb_activity")
public class Activity implements Serializable {


    public static final String FILED_START_TIME = "start_time";
    public static final String FILED_END_TIME = "end_time";
    public static final String FILED_STATUS = "status";
    private static final long serialVersionUID = -1492784991352553606L;
    @TableId(type = IdType.AUTO)
    /**
     * 活动id
     */
    private Integer id;

    /**
     * 活动名称
     */
    @NotBlank(message = "请填写活动名称")
    private String name;

    /**
     * 活动地址
     */
    @NotBlank(message = "请填写活动地址")
    private String url;

    /**
     * 宣传图片
     */
    private String pic;

    /**
     * 开始时间
     */
    @TableField("start_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @TableField("end_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    /**
     * 状态 1 开启 0 停止
     */
    @TableField("`status`")
    private Integer status;

    /**
     * 创建时间
     */
    @TableField("`create_time`")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @TableField("`update_time`")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 创建人
     */
    @TableField("`create_user`")
    private String createUser;

    /**
     * 活动类型 1 单品秒杀
     */
    @NotNull(message = "请选择活动类型")
    private Integer type;

    @Override
    public String toString() {
        return "Activity{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", url='" + url + '\'' +
                ", startTime=" + startTime +
                ", pic=" + pic +
                ", endTime=" + endTime +
                ", status=" + status +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", createUser='" + createUser + '\'' +
                ", type=" + type +
                '}';
    }
}